home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / expense.gl.p < prev    next >
Text File  |  2003-09-23  |  16KB  |  401 lines

  1. {
  2.  
  3.   Hidden = TRUE;
  4.  
  5.   ChildID = {
  6.     GuiAnimation("background") {
  7.       AnimationID = "image/expense.pcx";
  8.       X = 0;
  9.       Y = 0;
  10.       },  
  11.   
  12.         GuiTextInput("screen_name") {
  13.       X = 30;
  14.       Y = 40;
  15.           Width = 55;
  16.           Height = 20;
  17.           FontID = "font/verdana_9.tf";
  18.       InputDisabled = TRUE;      
  19.           InputText = Mangle(306/*"Expenses"*/);
  20.         },    
  21.     GuiLayer("budget") {
  22.       X = 81;
  23.       Y = 79;
  24.       Hidden = FALSE;
  25.       FontID = "font/verdana_black_bold_14.tf";
  26.       ChildID = {
  27.       
  28.             GuiTextInput("description") {
  29.           X = -30;
  30.           Y = -5;
  31.               Width = 270;
  32.               Height = 30;
  33.           FontID = "font/verdana_black_bold_18.tf";
  34.           InputDisabled = TRUE;      
  35.           InputHorizontalAlign = CENTER;
  36.               InputText = Mangle(307/*"Description"*/);
  37.             },
  38.             
  39.             GuiTextInput("Expenditure") {
  40.           X = 253;
  41.           Y = -5;
  42.               Width = 145;
  43.               Height = 30;
  44.           InputHorizontalAlign = CENTER;
  45.           InputDisabled = TRUE;      
  46.           FontID = "font/verdana_black_bold_18.tf";
  47.               InputText = Mangle(308/*"Expenses"*/);
  48.             }, 
  49.             GuiTextInput("Income") {
  50.           X = 395;
  51.           Y = -5;
  52.               Width = 120;
  53.               Height = 30;
  54.           InputHorizontalAlign = CENTER;
  55.           InputDisabled = TRUE;      
  56.           FontID = "font/verdana_black_bold_18.tf";
  57.               InputText = Mangle(309/*"Income"*/);
  58.             }, 
  59.         GuiTextInput("cost_calculation") {
  60.           InputDisabled = TRUE;      
  61.               ScriptID = script {            
  62.             @show{
  63.               resid Game;
  64.               resid Player;
  65.               resid fontID;
  66.                   resid Scenario;
  67.               
  68.               int   player_cash;
  69.               int   food_expense;
  70.               int   hotel_expense;
  71.               int   fuel_expense;
  72.               int   mishap_expense;
  73.               int   ticket_expense;
  74.               int   total_expense;
  75.               int   commodity_revenue;
  76.               int   bonus_revenue;
  77.               int   total_revenue;
  78.               int   commodity_cost;
  79.               int   bonus_commodity_cost;
  80.               int   truck_trip_meter_cost;
  81.               int   truck_lease_cost_per_day;
  82.               int   truck_meter_cost_per_mile;
  83.               int   truck_lease_cost;
  84.               int   truck_lease_total_cost;              
  85.               
  86.               str   player_cash_str;
  87.               str   food_expense_str;
  88.               str   fuel_expense_str;
  89.               str   hotel_expense_str;
  90.               str   mishap_expense_str;
  91.               str   ticket_expense_str;
  92.               str   total_expense_str;
  93.               str   commodity_revenue_str;
  94.               str   bonus_revenue_str;
  95.               str   total_revenue_str;
  96.               str   truck_lease_total_cost_str;
  97.                         
  98.  
  99.               fontID = ResByName("font/square_black_on_gray_9.tf");
  100.               Game = ResByName("Game");
  101.                   Player = ResPropGetResID(Game,"game_cur_player");
  102.                   player_cash = ResPropGetInt(Player, "expense_cash_in_hand");       
  103.                   player_cash_str = StrFormatStr("$ %s",IntToDecimalStr(player_cash,100));                             
  104.                 ResPropSetStr(GuiSiblingByName("expense/starting_balance_value"), "InputText", player_cash_str);
  105.                          
  106.                   commodity_cost = ResPropGetInt(Game,"game_salary_per_commodity");
  107.                   bonus_commodity_cost = ResPropGetInt(Game,"game_salary_bonus_commodity");
  108.               truck_lease_cost_per_day = ResPropGetInt(Game,"game_truck_lease_cost_per_day");
  109.               truck_meter_cost_per_mile = ResPropGetInt(Game,"game_truck_meter_cost_per_mile");
  110.                                                     
  111.               food_expense = ResPropGetInt(Player, "expense_spent_on_food");
  112.                   total_expense += food_expense;  
  113.                   food_expense_str = StrFormatStr("($ %s)", IntToDecimalStr(food_expense,100));
  114.               ResPropSetStr(GuiSiblingByName("expense/food_expense_value"), "InputText", food_expense_str);
  115.                                                                                  
  116.                   fuel_expense = ResPropGetInt(Player, "expense_spent_on_fuel");
  117.                   total_expense += fuel_expense;
  118.               fuel_expense_str = StrFormatStr("($ %s)", IntToDecimalStr(fuel_expense,100)); 
  119.               ResPropSetStr(GuiSiblingByName("expense/fuel_expense_value"), "InputText", fuel_expense_str);
  120.                                            
  121.                   hotel_expense = ResPropGetInt(Player, "expense_spent_on_hotel");
  122.                   total_expense += hotel_expense;
  123.               hotel_expense_str = StrFormatStr("($ %s)", IntToDecimalStr(hotel_expense,100)); 
  124.               ResPropSetStr(GuiSiblingByName("expense/hotel_expense_value"), "InputText", hotel_expense_str);           
  125.             
  126.                   mishap_expense = ResPropGetInt(Player, "expense_spent_on_mishap");
  127.                   total_expense += mishap_expense;      
  128.               mishap_expense_str = StrFormatStr("($ %s)", IntToDecimalStr(mishap_expense,100)); 
  129.               ResPropSetStr(GuiSiblingByName("expense/mishap_expense_value"), "InputText", mishap_expense_str);
  130.             
  131.                   ticket_expense = ResPropGetInt(Player, "expense_spent_on_ticket");
  132.                   total_expense += ticket_expense;      
  133.               ticket_expense_str = StrFormatStr("($ %s)", IntToDecimalStr(ticket_expense,100));                        
  134.               ResPropSetStr(GuiSiblingByName("expense/ticket_expense_value"), "InputText", ticket_expense_str); 
  135.               
  136.               /* display truck lease cost */
  137.               truck_trip_meter_cost = ResPropGetInt(Player, "truck_trip_meter") * truck_meter_cost_per_mile;
  138.               truck_lease_cost = (TimeGetDay(ResPropGetInt(Player, "time_now"))-1) * truck_lease_cost_per_day;
  139.               truck_lease_total_cost = (truck_trip_meter_cost + truck_lease_cost)/10;
  140.               total_expense += truck_lease_total_cost;
  141.               truck_lease_total_cost_str = StrFormatStr("($ %s)", IntToDecimalStr(truck_lease_total_cost,100));      
  142.               ResPropSetStr(GuiSiblingByName("expense/truck_lease_value"), "InputText", truck_lease_total_cost_str); 
  143.               
  144.               total_expense_str = StrFormatStr("($ %s)", IntToDecimalStr(total_expense,100)); 
  145.               ResPropSetStr(GuiSiblingByName("expense/total_expense_value"), "InputText", total_expense_str);          
  146.  
  147.               /* display all commodities revenue when user gets to destination */
  148.               if (ResPropGetInt(Player, "player_destination_arrived") == 1) {
  149.                 
  150.                 /* get number of commodity player picked up */
  151.                       commodity_revenue = ResPropGetInt(Player,"commodity_number_of") * commodity_cost;
  152.                       
  153.                 /* check bonus commodity */
  154.                 if (ResPropGetInt(ResPropGetResID(Player, "commodity_bonus"),"commodity_state") == 1) {      
  155.                   commodity_revenue += bonus_commodity_cost;
  156.                 }
  157.                 
  158.                 commodity_revenue_str = StrFormatStr("$ %s", IntToDecimalStr(commodity_revenue,100)); 
  159.                 ResPropSetStr(GuiSiblingByName("commodity_revenue_value"), "InputText", commodity_revenue_str);
  160.                 ResPropSetInt(GuiSiblingByName("commodity_revenue_value"), "Hidden", FALSE);                   
  161.                 
  162.               } else {
  163.                 ResPropSetInt(GuiSiblingByName("commodity_revenue_value"), "Hidden", TRUE); 
  164.               }
  165.                             
  166.               /* display GRAND TOTAL */
  167.               total_revenue = player_cash+commodity_revenue+bonus_revenue-total_expense;   
  168.               
  169.                           
  170.               
  171.               if (total_revenue < 0) { 
  172.                 total_revenue *= -1;
  173.                 total_revenue_str = StrFormatStr("($ %s)", IntToDecimalStr(total_revenue,100));
  174.                 ResPropSetResID(GuiSiblingByName("total_revenue_value"), "FontID", ResByName("font/verdana_red_bold_14.tf")); 
  175.               } else {
  176.                 total_revenue_str = StrFormatStr("$ %s", IntToDecimalStr(total_revenue,100));
  177.                 ResPropSetResID(GuiSiblingByName("total_revenue_value"), "FontID", ResByName("font/verdana_black_bold_14.tf")); 
  178.               }
  179.               ResPropSetStr(GuiSiblingByName("total_revenue_value"), "InputText", total_revenue_str); 
  180.                                       
  181.             }  
  182.           }; 
  183.             },      /* END OF COST CALCULATION */
  184.             
  185.             GuiLayer("expense") {
  186.           X = 0;
  187.           Y = 60;
  188.           
  189.           ChildID = {  
  190.             GuiTextInput("starting_balance_label") {
  191.               X = 40;
  192.               Y = -25;
  193.                   Width = 210;
  194.                   Height = 25;
  195.               InputDisabled = TRUE;      
  196.                   InputText = Mangle(310/*"Starting Balance"*/);
  197.                 },
  198.                 GuiTextInput("starting_balance_value") {
  199.               X = 400;
  200.               Y = -25;
  201.                   Width = 115;
  202.                   Height = 25;                
  203.               InputDisabled = TRUE;      
  204.               InputHorizontalAlign = RIGHT;
  205.                   InputText = Mangle(311/*"Starting Balance"*/);
  206.                 },
  207.                 GuiTextInput("food_expense_label") {
  208.               X = 40;
  209.               Y = 10;
  210.                   Width = 210;
  211.                   Height = 25;
  212.               InputDisabled = TRUE;      
  213.                   InputText = Mangle(312/*"Food Cost"*/);
  214.                 },
  215.                 GuiTextInput("food_expense_value") {
  216.               X = 265;
  217.               Y = 10;
  218.                   Width = 130;
  219.                   Height = 25;
  220.               FontID = "font/verdana_red_bold_14.tf";
  221.                   InputHorizontalAlign = RIGHT;
  222.               InputDisabled = TRUE;      
  223.                   InputText = "";
  224.                 },
  225.                 GuiTextInput("fuel_expense_label") {
  226.               X = 40;
  227.               Y = 45;
  228.                   Width = 210;
  229.                   Height = 25;
  230.               InputDisabled = TRUE;      
  231.                   InputText = Mangle(313/*"Fuel / Ferry Cost"*/);
  232.                 }, 
  233.                 GuiTextInput("fuel_expense_value") {
  234.               X = 265;
  235.               Y = 45;
  236.                   Width = 130;
  237.                   Height = 25;
  238.               FontID = "font/verdana_red_bold_14.tf";
  239.                   InputHorizontalAlign = RIGHT;
  240.               InputDisabled = TRUE;      
  241.                   InputText = "";
  242.                 },
  243.                 GuiTextInput("hotel_expense_label") {
  244.               X = 40;
  245.               Y = 82;
  246.                   Width = 210;
  247.                   Height = 25;
  248.               InputDisabled = TRUE;      
  249.                   InputText = Mangle(314/*"Lodging Cost"*/);
  250.                 },  
  251.                 GuiTextInput("hotel_expense_value") {
  252.               X = 265;
  253.               Y = 80;
  254.                   Width = 130;
  255.                   Height = 25;
  256.               FontID = "font/verdana_red_bold_14.tf";
  257.                   InputHorizontalAlign = RIGHT;
  258.               InputDisabled = TRUE;      
  259.                   InputText = "";
  260.                 },
  261.                 GuiTextInput("mishap_expense_label") {
  262.               X = 40;
  263.               Y = 120;
  264.                   Width = 210;
  265.                   Height = 25;
  266.               InputDisabled = TRUE;
  267.                   InputText = Mangle(315/*"Mishap Cost"*/);
  268.                 },
  269.                 GuiTextInput("mishap_expense_value") {
  270.               X = 265;
  271.               Y = 120;
  272.                   Width = 130;
  273.                   Height = 25;
  274.               FontID = "font/verdana_red_bold_14.tf";
  275.                   InputHorizontalAlign = RIGHT;
  276.               InputDisabled = TRUE;      
  277.                   InputText = "";
  278.                 },
  279.                 GuiTextInput("ticket_expense_label") {
  280.               X = 40;
  281.               Y = 155;
  282.                   Width = 210;
  283.                   Height = 25;
  284.               InputDisabled = TRUE;      
  285.                   InputText = Mangle(316/*"Ticket Cost"*/);
  286.                 },
  287.                 GuiTextInput("ticket_expense_value") {
  288.               X = 265;
  289.               Y = 155;
  290.                   Width = 130;
  291.                   Height = 25;
  292.               FontID = "font/verdana_red_bold_14.tf";
  293.                   InputHorizontalAlign = RIGHT;
  294.               InputDisabled = TRUE;      
  295.                   InputText = "";
  296.                 },    
  297.                 GuiTextInput("truck_lease_label") {
  298.               X = 40;
  299.               Y = 190;
  300.                   Width = 210;
  301.                   Height = 25;
  302.               InputDisabled = TRUE;      
  303.                   InputText = Mangle(317/*"Truck Lease"*/);
  304.                 },
  305.                 GuiTextInput("truck_lease_value") {
  306.               X = 265;
  307.               Y = 190;
  308.                   Width = 130;
  309.                   Height = 25; 
  310.               InputHorizontalAlign = RIGHT;
  311.               FontID = "font/verdana_red_bold_14.tf";
  312.               InputDisabled = TRUE;      
  313.                   InputText = "";
  314.                 },
  315.                 GuiTextInput("total_expense_label") {
  316.               X = 128;
  317.               Y = 260;
  318.                   Width = 130;
  319.                   Height = 25;
  320.                   InputHorizontalAlign = RIGHT;
  321.               InputDisabled = TRUE;      
  322.                   InputText = Mangle(318/*"Total Expenses"*/);
  323.                 },
  324.                 GuiTextInput("total_expense_value") {
  325.               X = 265;
  326.               Y = 260;
  327.                   Width = 130;
  328.                   Height = 25;
  329.               FontID = "font/verdana_red_bold_14.tf";
  330.                   InputHorizontalAlign = RIGHT;
  331.               InputDisabled = TRUE;      
  332.                   InputText = "";
  333.                 }
  334.             };    /* END OF COST ChildID */
  335.         },      /* END OF COST GUILAYER */
  336.                     
  337.             GuiAnimation("truck_lease_icon") {
  338.           X = -15;
  339.           Y = 251;
  340.           AnimationID = "gui/laptop/laptop_tab/truck_lease.pcx";             
  341.         },
  342.         GuiAnimation("commodity_revenue_icon") {
  343.           X = -13;
  344.           Y = 286;
  345.           AnimationID = "gui/laptop/laptop_tab/commodity.pcx";
  346.           ScriptID = script {
  347.             @show {
  348.               resid Player;
  349.               resid Commodity_bonus;
  350.               Player = ResPropGetResID(ResByName("Game"),"game_cur_player"); 
  351.               Commodity_bonus = ResPropGetResID(Player, "commodity_bonus");
  352.               if (ResPropGetInt(Commodity_bonus, "commodity_state") == 1) {
  353.                 ResPropSetResID(SELF, "AnimationID", ResByName("gui/laptop/laptop_tab/commodity_bonus.pcx"));
  354.               }              
  355.             }
  356.           };
  357.         },
  358.             GuiTextInput("commodity_revenue_label") {
  359.           X = 40;
  360.           Y = 288;
  361.               Width = 210;
  362.               Height = 25;
  363.           FontID = "font/verdana_black_bold_14.tf";
  364.           InputDisabled = TRUE;      
  365.               InputText = Mangle(319/*"Commodity Revenue"*/);
  366.             },            
  367.             GuiTextInput("commodity_revenue_value") {
  368.           X = 400;
  369.           Y = 288;
  370.               Width = 115;
  371.               Height = 25; 
  372.           InputHorizontalAlign = RIGHT;
  373.           FontID = "font/verdana_black_bold_14.tf";
  374.           InputDisabled = TRUE;      
  375.               InputText = "";
  376.             },
  377.             GuiTextInput("revenue_label") {
  378.           X = 109;
  379.           Y = 345;
  380.               Width = 150;
  381.               Height = 25;
  382.           FontID = "font/verdana_black_bold_14.tf";
  383.           InputDisabled = TRUE;      
  384.           InputHorizontalAlign = RIGHT;
  385.               InputText = Mangle(320/*"Total Revenue"*/);
  386.             },
  387.             GuiTextInput("total_revenue_value") {
  388.           X = 295;
  389.           Y = 345;
  390.               Width = 220;
  391.           Height = 25;    
  392.           InputHorizontalAlign = RIGHT;
  393.           FontID = "font/verdana_black_bold_14.tf";
  394.           InputDisabled = TRUE;      
  395.               InputText = "";
  396.             }
  397.       };  /* END OF BUDGET ChildID */
  398.     }     /* END OF BUDGET */
  399.   };      /* END OF MAIN ChildID */
  400. }
  401.